package pl.edu.agh.student.nn.core;

/**
 * 
 * Progowa funcja aktywacji
 * 
 */
public class ThresholdFunction extends ActivationFunction {

    private double threshold;

    public ThresholdFunction() {
        super(ActivationFunctionType.T);
    }

    public ThresholdFunction(double threshold) {
        super(ActivationFunctionType.T);
        this.threshold = threshold;
    }

    public double getResult(double input) {
        if (input >= threshold) {
            return 1;
        }
        return 0;
    }

    @Override
    public String display() {
        return type + "|" + threshold;
    }

    @Override
    public String toString() {
        return "ThresholdFunction{" + "threshold=" + threshold + '}';
    }

    @Override
    public double d(double input)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}